<!DOCTYPE html>
<html lang="en" ng-app="myApp">
<head>
    <meta charset="UTF-8">
    <script src="../../js/angular/angular.min.js"></script>
    <title></title>
</head>
<body ng-controller="myController">
<input type="text" ng-model="user.name"><br/>
{{user.name}}
<script>
    var myApp = angular.module('myApp', []);
    myApp.controller('myController', function ($scope) {
                $scope.$watch('user.name', function () {
                    alert(1);
                });
            }
    );
</script>
</body>
</html>